#ifndef MYTIMER_H
#define MYTIMER_H

#include <set>
#include <vector>
#include <map>
#include <string>
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include "QueryTypes.h"

#include "ParentHandle.h"
#include "FollowsHandle.h"
#include "UsesHandle.h"
#include "ModifiesHandle.h"
#include "NextHandle.h"
#include "CallsHandle.h"
#include "AffectsHandle.h"
#include "Pattern.h"
#include "SiblingHandle.h"

class MyTimer
{
	private:
		int stepSize;
		int debug;
		unsigned __int64 clocks_per_sec;
		unsigned __int64 clockCycleLimit;
		ParentHandle* _parenthandle;
		FollowsHandle* _followshandle;
		UsesHandle* _useshandle;
		ModifiesHandle* _modifieshandle;
		NextHandle* _nexthandle;
		CallsHandle* _callshandle;
		AffectsHandle* _affectshandle;
		SiblingHandle* _siblinghandle;
		Pattern _patternhandle;
		vector<string> relation;
		vector<unsigned __int64> result;
		static const unsigned int SMALLEST_VALUE=5;
		int findMin(vector<unsigned __int64> v);
		unsigned __int64 calculateClocksPerSec();
	public:
		MyTimer();
		~MyTimer();
		int random(int max);
		unsigned __int64 GetCpuClock();
		unsigned __int64 GetCpuClock2();
		unsigned __int64 calls();
		unsigned __int64 follows();
		unsigned __int64 parents();
		unsigned __int64 next();
		unsigned __int64 affects();
		unsigned __int64 callsT();
		unsigned __int64 followsT();
		unsigned __int64 parentsT();
		unsigned __int64 nextT();
		unsigned __int64 affectsT();
		unsigned __int64 modifiesS();
		unsigned __int64 modifiesP();
		unsigned __int64 usesS();
		unsigned __int64 usesP();
		unsigned __int64 patternA();
		unsigned __int64 patternI();
		unsigned __int64 patternW();
		unsigned __int64 sibling();
		unsigned __int64 callsV2();
		unsigned __int64 followsV2();
		unsigned __int64 parentsV2();
		unsigned __int64 nextV2();
		unsigned __int64 affectsV2();
		unsigned __int64 callsTV2();
		unsigned __int64 followsTV2();
		unsigned __int64 parentsTV2();
		unsigned __int64 nextTV2();
		unsigned __int64 affectsTV2();
		unsigned __int64 modifiesSV2();
		unsigned __int64 modifiesPV2();
		unsigned __int64 usesSV2();
		unsigned __int64 usesPV2();
		unsigned __int64 patternAV2();
		unsigned __int64 patternIV2();
		unsigned __int64 patternWV2();
		unsigned __int64 siblingV2();
		unsigned __int64 callsV3();
		unsigned __int64 followsV3();
		unsigned __int64 parentsV3();
		unsigned __int64 nextV3();
		unsigned __int64 affectsV3();
		unsigned __int64 callsTV3();
		unsigned __int64 followsTV3();
		unsigned __int64 parentsTV3();
		unsigned __int64 nextTV3();
		unsigned __int64 affectsTV3();
		unsigned __int64 modifiesSV3();
		unsigned __int64 modifiesPV3();
		unsigned __int64 usesSV3();
		unsigned __int64 usesPV3();
		unsigned __int64 patternAV3();
		unsigned __int64 patternIV3();
		unsigned __int64 patternWV3();
		unsigned __int64 siblingV3();
		unsigned __int64 callsV4();
		unsigned __int64 followsV4();
		unsigned __int64 parentsV4();
		unsigned __int64 nextV4();
		unsigned __int64 modifiesSV4();
		unsigned __int64 modifiesPV4();
		unsigned __int64 usesSV4();
		unsigned __int64 usesPV4();
		unsigned __int64 patternAV4();
		unsigned __int64 patternIV4();
		unsigned __int64 patternWV4();
		vector<string> returnRelation();
		vector<unsigned __int64> returnResult();
		void process();
		void processV2();
		void processV1();
		void processV3();
		void processV4();
		void processV5();
};

#endif